class {
    onMount() {
        this.events = [];
    }

    handleDetach(color, event, node) {
        this.events.push({
            color: color,
            event: event,
            node: node
        });
    }
}

<div>
    <ul>
        <for|color| of=input.colors>
            <li key=color on-detach("handleDetach", color)>${color}</li>
        </for>
    </ul>
</div>